package com.itheima.controller;


import com.itheima.pojo.OperateLog;
import com.itheima.pojo.PageResult;
import com.itheima.pojo.Result;
import com.itheima.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/log")
public class LogController {

    @Autowired
    private LogService logService;

    /**
     * 查询操作的日志
     */
    @GetMapping("/page")
    public Result page(@RequestParam(name = "page", defaultValue = "1") Integer page,
                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        log.info("查询操作的日志:{},{}",page,pageSize);
         PageResult<OperateLog> pageResult =  logService.page( page, pageSize);
         return Result.success(pageResult);
    }
}
